﻿<Page
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:VMDS_GUIClient_ViewModels_Management_VMs="clr-namespace:VMDS.GUIClient.ViewModels.Management.VMs" xmlns:VMDS_GUIClient_Helper="clr-namespace:VMDS.GUIClient.Helper" xmlns:VMDS_GUIClient_Views="clr-namespace:VMDS.GUIClient.Views" x:Class="VMDS.GUIClient.Views.Management.VMs.VmWizard" 
      mc:Ignorable="d" 
      d:DesignHeight="368" d:DesignWidth="600"
	Title="VmWizard">
	<Page.Resources>
		<ResourceDictionary>
			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary Source="/VMDS.GUIClient;component/Views/ResourceDictionary1.xaml"/>
			</ResourceDictionary.MergedDictionaries>
			<VMDS_GUIClient_Helper:BooleanToHiddenVisibility x:Key="BooleanToHiddenVisibility"/>
			<DataTemplate x:Key="MyEquityTemplate2">
				<DataTemplate.Resources>
					<Storyboard x:Key="OnMouseEnter1">
						<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(Brush.Opacity)" Storyboard.TargetName="GelBackground">
							<EasingDoubleKeyFrame KeyTime="0" Value="0.7"/>
						</DoubleAnimationUsingKeyFrames>
					</Storyboard>
					<Storyboard x:Key="OnMouseLeave1">
						<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(Brush.Opacity)" Storyboard.TargetName="GelBackground">
							<EasingDoubleKeyFrame KeyTime="0" Value="0.3"/>
						</DoubleAnimationUsingKeyFrames>
					</Storyboard>
				</DataTemplate.Resources>
				<Grid x:Name="grid" Margin="0" Height="Auto" d:DesignWidth="256" RenderTransformOrigin="0.5,0.5" Width="172">
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="*"/>
					</Grid.ColumnDefinitions>
					<Grid.RowDefinitions>
						<RowDefinition Height="*"/>
					</Grid.RowDefinitions>
					<Grid.RenderTransform>
						<TransformGroup>
							<ScaleTransform/>
							<SkewTransform/>
							<RotateTransform/>
							<TranslateTransform/>
						</TransformGroup>
					</Grid.RenderTransform>
					<Rectangle x:Name="GelBackground" Opacity="1" RadiusX="8" RadiusY="8" StrokeThickness="0.5" Stroke="{x:Null}" Grid.Row="0" Grid.RowSpan="1" Grid.ColumnSpan="1" Grid.Column="0" Margin="5,2" Width="Auto" Height="Auto">
						<Rectangle.Fill>
							<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" Opacity="0.3">
								<GradientStop Color="#FFEFECEC"/>
								<GradientStop Offset="0.361"/>
								<GradientStop Color="#FFEFECEC" Offset="1"/>
								<GradientStop Offset="0.699"/>
							</LinearGradientBrush>
						</Rectangle.Fill>
					</Rectangle>
					<TextBlock FontFamily="Segoe UI"    x:Name="NameBlock" Grid.Column="0"  Width="Auto"  Text="{Binding Name, Mode=OneWay}" Margin="10,7" FontSize="16" FontWeight="Bold" VerticalAlignment="Stretch" Height="Auto" TextAlignment="Center" Grid.Row="0"/>
				</Grid>
				<DataTemplate.Triggers>
					<EventTrigger RoutedEvent="Mouse.MouseLeave" SourceName="grid">
						<BeginStoryboard x:Name="OnMouseLeave1_BeginStoryboard" Storyboard="{StaticResource OnMouseLeave1}"/>
					</EventTrigger>
					<EventTrigger RoutedEvent="Mouse.MouseEnter" SourceName="grid">
						<BeginStoryboard Storyboard="{StaticResource OnMouseEnter1}"/>
					</EventTrigger>
				</DataTemplate.Triggers>
			</DataTemplate>
			<DataTemplate x:Key="MyEquityTemplate">
				<DataTemplate.Resources>
					<Storyboard x:Key="OnMouseEnter1">
						<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(Brush.Opacity)" Storyboard.TargetName="GelBackground">
							<EasingDoubleKeyFrame KeyTime="0" Value="0.7"/>
						</DoubleAnimationUsingKeyFrames>
					</Storyboard>
					<Storyboard x:Key="OnMouseLeave1">
						<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(Brush.Opacity)" Storyboard.TargetName="GelBackground">
							<EasingDoubleKeyFrame KeyTime="0" Value="0.3"/>
						</DoubleAnimationUsingKeyFrames>
					</Storyboard>
				</DataTemplate.Resources>
				<Grid x:Name="grid" Margin="0" Height="40" d:DesignWidth="400" Width="300" RenderTransformOrigin="0.5,0.5">
					<Grid.ColumnDefinitions>
						<ColumnDefinition Width="*"/>
					</Grid.ColumnDefinitions>
					<Grid.RowDefinitions>
						<RowDefinition Height="*"/>
					</Grid.RowDefinitions>
					<Grid.RenderTransform>
						<TransformGroup>
							<ScaleTransform/>
							<SkewTransform/>
							<RotateTransform/>
							<TranslateTransform/>
						</TransformGroup>
					</Grid.RenderTransform>
					<Rectangle x:Name="GelBackground" Opacity="1" RadiusX="8" RadiusY="8" StrokeThickness="0.5" Stroke="{x:Null}" Grid.Row="0" Grid.RowSpan="1" Grid.ColumnSpan="1" Grid.Column="0" Margin="5,2" Width="290" Height="36">
						<Rectangle.Fill>
							<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" Opacity="0.3">
								<GradientStop Color="#FFEFECEC"/>
								<GradientStop Offset="0.361"/>
								<GradientStop Color="#FFEFECEC" Offset="1"/>
								<GradientStop Offset="0.699"/>
							</LinearGradientBrush>
						</Rectangle.Fill>
					</Rectangle>
					<TextBlock FontFamily="Segoe UI"    x:Name="NameBlock" Grid.Column="0"  Width="280"  Text="{Binding Name, Mode=OneWay}" Margin="10,7" FontSize="16" FontWeight="Bold" VerticalAlignment="Stretch" Height="26" TextAlignment="Center" Grid.Row="0"/>
				</Grid>
				<DataTemplate.Triggers>
					<EventTrigger RoutedEvent="Mouse.MouseLeave" SourceName="grid">
						<BeginStoryboard x:Name="OnMouseLeave1_BeginStoryboard" Storyboard="{StaticResource OnMouseLeave1}"/>
					</EventTrigger>
					<EventTrigger RoutedEvent="Mouse.MouseEnter" SourceName="grid">
						<BeginStoryboard Storyboard="{StaticResource OnMouseEnter1}"/>
					</EventTrigger>
				</DataTemplate.Triggers>
			</DataTemplate>
			<Style x:Key="CustomListBoxItem" TargetType="{x:Type ListBoxItem}">
				<Setter Property="SnapsToDevicePixels" Value="true"/>
				<Setter Property="OverridesDefaultStyle" Value="true"/>
				<Setter Property="Template">
					<Setter.Value>
						<ControlTemplate TargetType="{x:Type ListBoxItem}">
							<Border  x:Name="Border" Padding="1" SnapsToDevicePixels="true">
								<ContentPresenter />
							</Border>
						</ControlTemplate>
					</Setter.Value>
				</Setter>
			</Style>
			<Style x:Key="ScrollBarPageButton" TargetType="{x:Type RepeatButton}">
				<Setter Property="SnapsToDevicePixels" Value="True"/>
				<Setter Property="OverridesDefaultStyle" Value="true"/>
				<Setter Property="IsTabStop" Value="false"/>
				<Setter Property="Focusable" Value="false"/>
				<Setter Property="Template">
					<Setter.Value>
						<ControlTemplate TargetType="{x:Type RepeatButton}">
							<Border Background="Transparent" />
						</ControlTemplate>
					</Setter.Value>
				</Setter>
			</Style>
			<Style x:Key="ScrollBarThumbVertical" TargetType="{x:Type Thumb}">
				<Setter Property="SnapsToDevicePixels" Value="True"/>
				<Setter Property="OverridesDefaultStyle" Value="true"/>
				<Setter Property="IsTabStop" Value="false"/>
				<Setter Property="Focusable" Value="false"/>
				<Setter Property="Template">
					<Setter.Value>
						<ControlTemplate TargetType="{x:Type Thumb}">
							<Border CornerRadius="2" 
								BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" Background="{x:Null}" >
								<Grid>
									<Grid.RowDefinitions>
										<RowDefinition Height="0.917*"/>
										<RowDefinition Height="0.083*"/>
									</Grid.RowDefinitions>
									<Grid.ColumnDefinitions>
										<ColumnDefinition Width="0.951*"/>
										<ColumnDefinition Width="0.049*"/>
									</Grid.ColumnDefinitions>
									<Rectangle Grid.Column="1" Margin="0" RadiusX="2" RadiusY="2" Grid.Row="0" Grid.RowSpan="2" Grid.ColumnSpan="1">
										<Rectangle.Fill>
											<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
												<GradientStop Color="#FF33E1E5" Offset="0.514"/>
												<GradientStop Color="White" Offset="1"/>
												<GradientStop Color="#FFEEF1F1" Offset="0.052"/>
											</LinearGradientBrush>
										</Rectangle.Fill>
									</Rectangle></Grid>
							</Border>
						</ControlTemplate>
					</Setter.Value>
				</Setter>
			</Style>
			<SolidColorBrush x:Key="PressedBrush" Color="#FFEEEEEE"/>
			<SolidColorBrush x:Key="DisabledForegroundBrush" Color="#888" />
			<LinearGradientBrush x:Key="NormalBorderBrush" StartPoint="0,0" EndPoint="0,1">
				<LinearGradientBrush.GradientStops>
					<GradientStopCollection>
						<GradientStop Color="#CCC" Offset="0.0"/>
						<GradientStop Color="#444" Offset="1.0"/>
					</GradientStopCollection>
				</LinearGradientBrush.GradientStops>
			</LinearGradientBrush>
			<Style x:Key="ScrollBarLineButton" TargetType="{x:Type RepeatButton}">
				<Setter Property="SnapsToDevicePixels" Value="True"/>
				<Setter Property="OverridesDefaultStyle" Value="true"/>
				<Setter Property="Focusable" Value="false"/>
				<Setter Property="Template">
					<Setter.Value>
						<ControlTemplate TargetType="{x:Type RepeatButton}">
							<Border x:Name="Border" CornerRadius="2"  Background="Transparent"
								BorderBrush="{StaticResource NormalBorderBrush}" >
								<Path HorizontalAlignment="Center" VerticalAlignment="Center" Fill="#FF1DC4C0"
									Data="{Binding Content, RelativeSource={RelativeSource TemplatedParent}}" 
									Opacity="{Binding Opacity, RelativeSource={RelativeSource TemplatedParent}}"  />
							</Border>
							<ControlTemplate.Triggers>
								<Trigger Property="IsPressed" Value="true">
									<Setter TargetName="Border" Property="Background" Value="{StaticResource PressedBrush}" />
								</Trigger>
								<Trigger Property="IsEnabled" Value="false">
									<Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}"/>
								</Trigger>
							</ControlTemplate.Triggers>
						</ControlTemplate>
					</Setter.Value>
				</Setter>
			</Style>
			<Style x:Key="ListBoxWithAutoScroll_Vertical" TargetType="{x:Type ListBox}" >
				<Setter Property="SnapsToDevicePixels" Value="true"/>
				<Setter Property="OverridesDefaultStyle" Value="true"/>
				<Setter Property="ItemTemplate" Value="{DynamicResource MyEquityTemplate}"/>
				<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
				<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
				<Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
				<Setter Property="Background" Value="Transparent"/>
				<Setter Property="ItemContainerStyle" Value="{StaticResource CustomListBoxItem}"/>
				<Setter Property="Template">
					<Setter.Value >
						<ControlTemplate>
							<Grid >
								<ScrollViewer x:Name="scrollviewer" BorderThickness="1" BorderBrush="#FF7FE5E3" >
									<ScrollViewer.Template>
										<ControlTemplate TargetType="{x:Type ScrollViewer}" >
											<Grid>
												<ScrollBar x:Name="PART_VerticalScrollBar" Orientation="Vertical" 
													Value="{TemplateBinding VerticalOffset}"
													Maximum="{TemplateBinding ScrollableHeight}"
													ViewportSize="{TemplateBinding ViewportHeight}"
													Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
													Width="{Binding Width, ElementName=Panel}">
													<ScrollBar.Template>
														<ControlTemplate>
															<Track x:Name="PART_Track" IsDirectionReversed="True">
																<Track.DecreaseRepeatButton>
																	<RepeatButton Command="ScrollBar.PageUpCommand"
																		Style="{StaticResource ScrollBarPageButton}"/>
																</Track.DecreaseRepeatButton>
																<Track.IncreaseRepeatButton>
																	<RepeatButton Command="ScrollBar.PageDownCommand"
																		Style="{StaticResource ScrollBarPageButton}"/>
																</Track.IncreaseRepeatButton>
																<Track.Thumb>
																	<Thumb Style="{StaticResource ScrollBarThumbVertical}" 
																		Background="Gray" Opacity="0.8" Margin="-1,0" />
																</Track.Thumb>
															</Track>
														</ControlTemplate>
													</ScrollBar.Template>
												</ScrollBar>
												<ScrollContentPresenter Margin="2,0" Width="Auto" HorizontalAlignment="Center"/>
											</Grid>
										</ControlTemplate>
									</ScrollViewer.Template>
									<ItemsPresenter/>
								</ScrollViewer>
								<Grid x:Name="Panel" Margin="2,0">
									<Grid.RowDefinitions>
										<RowDefinition Height="Auto"/>
										<RowDefinition Height="*"/>
										<RowDefinition Height="Auto"/>
									</Grid.RowDefinitions>
									<RepeatButton x:Name="LineUpButton" Grid.Row="0" Height="20" Opacity="0" Visibility="Collapsed"
										Style="{StaticResource ScrollBarLineButton}"
										Content="M 0 8 L 32 8 L 16 0 Z"      
										Command="{x:Static ScrollBar.LineUpCommand}"       
										CommandTarget="{Binding ElementName=scrollviewer}"
										ClickMode="Hover" />
									<RepeatButton x:Name="LineDownButton" Grid.Row="2" Height="20" Opacity="0" Visibility="Collapsed"
										Style="{StaticResource ScrollBarLineButton}"
										Content="M 0 0 L 16 8 L 32 0 Z" 
										Command="{x:Static ScrollBar.LineDownCommand}"       
										CommandTarget="{Binding ElementName=scrollviewer}"
										ClickMode="Hover"/>
								</Grid>
							</Grid>
							<ControlTemplate.Triggers>
								<MultiTrigger>
									<MultiTrigger.Conditions>
										<Condition Property="IsMouseOver" Value="True"/>
										<Condition Property="ComputedVerticalScrollBarVisibility" SourceName="scrollviewer" Value="Visible"/>
									</MultiTrigger.Conditions>
									<MultiTrigger.EnterActions>
										<BeginStoryboard>
											<Storyboard>
												<DoubleAnimation Storyboard.TargetName="LineUpButton" 
													Storyboard.TargetProperty="Opacity" To="0.8" Duration="0:0:0.25"/>
												<DoubleAnimation Storyboard.TargetName="LineDownButton" 
													Storyboard.TargetProperty="Opacity" To="0.8" Duration="0:0:0.25"/>
											</Storyboard>
										</BeginStoryboard>
									</MultiTrigger.EnterActions>
									<MultiTrigger.ExitActions>
										<BeginStoryboard>
											<Storyboard>
												<DoubleAnimation Storyboard.TargetName="LineUpButton" 
													Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.25"/>
												<DoubleAnimation Storyboard.TargetName="LineDownButton" 
													Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.25"/>
											</Storyboard>
										</BeginStoryboard>
									</MultiTrigger.ExitActions>
									<Setter TargetName="LineUpButton" Property="Visibility" Value="Visible" />
									<Setter TargetName="LineDownButton" Property="Visibility" Value="Visible" />
								</MultiTrigger>
							</ControlTemplate.Triggers>
						</ControlTemplate>
					</Setter.Value>
				</Setter>
				<Setter Property="ItemsPanel">
					<Setter.Value >
						<ItemsPanelTemplate>
							<VirtualizingStackPanel Orientation="Vertical"/>
						</ItemsPanelTemplate>
					</Setter.Value>
				</Setter>
			</Style>
		</ResourceDictionary>
	</Page.Resources>
	<Page.DataContext>
		<VMDS_GUIClient_ViewModels_Management_VMs:VmManagementViewModel/>
	</Page.DataContext>

    <Grid>
    	
		<Rectangle Margin="220,5,8,8" Stroke="#FFF8F3F3" StrokeThickness="0.5" RadiusX="10" RadiusY="10" Opacity="0.945">
    		<Rectangle.Fill>
    			<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" Opacity="0.435">
    				<LinearGradientBrush.RelativeTransform>
    					<TransformGroup>
    						<ScaleTransform CenterY="0.5" CenterX="0.5"/>
    						<SkewTransform CenterY="0.5" CenterX="0.5"/>
    						<RotateTransform CenterY="0.5" CenterX="0.5"/>
    						<TranslateTransform/>
    					</TransformGroup>
    				</LinearGradientBrush.RelativeTransform>
    				<GradientStop Color="#FFEFECEC"/>
    				<GradientStop Offset="0.614"/>
    				<GradientStop Color="#FFEFECEC" Offset="1"/>
    				<GradientStop Offset="0.386"/>
    			</LinearGradientBrush>
    		</Rectangle.Fill>
    	</Rectangle>
    	
		<Rectangle Margin="5,5,0,8" Stroke="#FFF8F3F3" StrokeThickness="0.5" RadiusX="10" RadiusY="10" Opacity="0.945" HorizontalAlignment="Left" Width="211">
    		<Rectangle.Fill>
    			<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" Opacity="0.435">
    				<LinearGradientBrush.RelativeTransform>
    					<TransformGroup>
    						<ScaleTransform CenterY="0.5" CenterX="0.5"/>
    						<SkewTransform CenterY="0.5" CenterX="0.5"/>
    						<RotateTransform CenterY="0.5" CenterX="0.5"/>
    						<TranslateTransform/>
    					</TransformGroup>
    				</LinearGradientBrush.RelativeTransform>
    				<GradientStop Color="#FFEFECEC"/>
    				<GradientStop Offset="0.614"/>
    				<GradientStop Color="#FFEFECEC" Offset="1"/>
    				<GradientStop Offset="0.386"/>
    			</LinearGradientBrush>
    		</Rectangle.Fill>
    	</Rectangle>
    	<ListBox Margin="18,18,0,103" Style="{DynamicResource ListBoxWithAutoScroll_Vertical}" ItemsSource="{Binding VMs}" Background="{x:Null}" ScrollViewer.VerticalScrollBarVisibility="Auto" ItemTemplate="{DynamicResource MyEquityTemplate2}" BorderBrush="#FF397589" BorderThickness="1" SelectedItem="{Binding CurrentVM}" HorizontalAlignment="Left" Width="174" />
    	<Button x:Name="AddBut" Margin="18,0,0,20" Style="{DynamicResource Button}" VerticalAlignment="Bottom" Height="48" ToolTip="Добавление новой виртуальной машины в системы" Click="AddBut_Click" Grid.Row="0" Grid.Column="0" d:LayoutOverrides="VerticalAlignment, GridBox" HorizontalAlignment="Left" Width="72">
    		<StackPanel>
    			<Image Margin="0" Source="/VMDS.GUIClient;component/Views/Images/add.png" OpacityMask="White" Width="30"/>
    			<TextBlock Text="Добавить" TextWrapping="Wrap" TextAlignment="Center" VerticalAlignment="Center" FontWeight="Bold" Margin="0"/>
    		</StackPanel>
    	</Button>
    	<Button Margin="120,0,0,20" Style="{DynamicResource DisabledButton}" Height="48" VerticalAlignment="Bottom" Grid.Row="0" Grid.Column="0" d:LayoutOverrides="VerticalAlignment, GridBox" HorizontalAlignment="Left" Width="72" Command="{Binding DeleteRequest, Mode=OneWay}">
    		<StackPanel>
    			<Image Margin="0" Source="/VMDS.GUIClient;component/Views/Images/cancel.png" OpacityMask="White" Width="30"/>
    			<TextBlock Text="Удалить" TextWrapping="Wrap" TextAlignment="Center" VerticalAlignment="Center" FontWeight="Bold"/>
    		</StackPanel>
    	</Button>
    	<TextBlock Height="25" Margin="226.11,18,269.89,0" TextWrapping="Wrap" Text="Название" VerticalAlignment="Top" FontSize="18.667"/>
    	<TextBox Margin="0,18,16,0" TextWrapping="Wrap" Text="{Binding VmName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="18.667" Height="25" VerticalAlignment="Top" HorizontalAlignment="Right" Width="249.89"/>
    	<TextBlock Height="25" Margin="226.11,55,269.89,0" TextWrapping="Wrap" Text="Описание" VerticalAlignment="Top" FontSize="18.667"/>
    	<TextBox Margin="0,55,16,0" TextWrapping="Wrap" Text="{Binding VmDescr, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="18.667" Height="89" VerticalAlignment="Top" HorizontalAlignment="Right" Width="249.89"/>
    	<Button x:Name="AddBut_Copy" Margin="0,0,16,20" Style="{DynamicResource DisabledButton}" VerticalAlignment="Bottom" Height="48" ToolTip="Добавление новой виртуальной машины в системы" Grid.Row="0" Grid.Column="0" HorizontalAlignment="Right" Width="72" d:LayoutOverrides="VerticalAlignment, GridBox" Command="{Binding Change, Mode=OneWay}">
    		<StackPanel>
    			<Image Margin="0" Source="/VMDS.GUIClient;component/Views/Images/ok.png" OpacityMask="White" Width="30"/>
    			<TextBlock Text="Сохранить" TextWrapping="Wrap" TextAlignment="Center" VerticalAlignment="Center" FontWeight="Bold" Margin="0"/>
    		</StackPanel>
    	</Button>
    	<CheckBox Content="Отображать" HorizontalAlignment="Right" Margin="0,170,146.96,175.47" FontSize="18.667" d:LayoutOverrides="HorizontalAlignment, Height" IsChecked="{Binding IsVisible}"/>
    </Grid>
</Page>
